package bp.App.Demo;

import bp.da.DBAccess;
import bp.da.DataType;
import bp.difference.SystemConfig;
import bp.tools.DateUtils;
import bp.tools.MD5Utill;

import java.time.LocalDate;
import java.time.LocalDateTime;

public class Test {


    public static void main(String[] args) {
//        md5log();
//        encodeSign();
//        fs();
        date1();
    }
    public static void date1() {
        // 获取昨天的日期，然后组合成凌晨时间
//        LocalDateTime yesterdayMidnight = LocalDate.now()
//                .minusDays(1)
//                .atStartOfDay(); // 直接返回当天的00:00:00
    }
    private static void fs(){
        try {
            Class<?> cls = Class.forName("bp.App.Demo.Handler_Demo");
            System.out.println(cls.getName()   );
            // 使用cls进行后续操作
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }
    //登录接口（Port_Login）privateKey的获取
    private  static void md5log(){
        String str = "admin" +  DataType.getCurrentDateByFormart("yyyy_MM_dd")+ "123";
        System.out.println(str);
        String val =  DBAccess.GenerMD5(str);
        String val2 = "admin" +  DBAccess.GenerMD5(str);
        System.out.println(val2);
    }

    //单点登录，加签 SSOSign
    private static void encodeSign(){
           String User="admin";
           Long timestamp=System.currentTimeMillis();
            //加密key,双方定义好
            String localKey = "DiGuaDiGua,IamCCBPM";
            //获取当前分钟数
            String signStr = User + "_" + timestamp;
            String signMD5 = MD5Utill.HmacMd5Encode(signStr, localKey);
            System.out.println(timestamp);
            System.out.println(signMD5);

    }
}
